import avahi, dbus, dbus.glib

def announce():
    stype = '_daap._tcp'
    domain = ''
    name = 'Shui DAAP'
    txt = 'Shui DAAP'
    host = ""
    port = 3689
    bus = dbus.SystemBus()
    server = dbus.Interface(bus.get_object(avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER), avahi.DBUS_INTERFACE_SERVER)

    g = dbus.Interface(bus.get_object(avahi.DBUS_NAME, server.EntryGroupNew()), avahi.DBUS_INTERFACE_ENTRY_GROUP)
    g.AddService(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, dbus.UInt32(0), name, stype, domain, host, dbus.UInt16(port), avahi.string_array_to_txt_array(txt))
    g.Commit()

announce()
